// components/select/select.js
const app = getApp()
Component({
  properties: {
    isOnTop: {
      type: Boolean,
      value: false
    },
    dataArr: {
      type: Array
    }
  },

  data: {
    lang: app.globalData.language,
    selectVal: "",
    selectOpen: false
  },

  methods: {
    // 打开下拉菜单
    openSelect: function(e){
      this.setData({
        selectOpen: true,
        lang: app.globalData.language
      })
    },
    // 选中
    selectEnd: function(e){
      let Index = '', disable = false;
      Index = e.currentTarget.dataset.name
      disable = e.currentTarget.dataset.disable
      if (disable) return

      this.setData({
        selectOpen: false,
        selectVal: Index
      })
      var myEventDetail = {
        selectVal: this.data.selectVal
      }
      this.triggerEvent('selectEnd', myEventDetail)
    },
  }
})
